package cur.nature.component.springai;

import cur.nature.framework.core.log.LOG;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.event.ContextClosedEvent;

@Configuration
@ConditionalOnProperty( value = {"cur.component.springai.enable"})
public class SpringAiListener {

    @Bean
    public ApplicationListener onSpringAiStart() {
        return (ApplicationListener<ApplicationReadyEvent>) event -> {
                LOG.info("SpringAi started-------------------------------");
            };
    };

    @Bean
    public ApplicationListener onSpringAiStop() {
        return (ApplicationListener<ContextClosedEvent>) event -> {
            LOG.info("SpringAi stopped-------------------------------");
        };
    }

}
